Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cypher query extraction for node names with spaces #24

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

chkaty
Copy link
Contributor

@chkaty chkaty commented Dec 18, 2024

Description:

This PR fixes an issue in GraphCypherQAChain where node labels containing spaces (e.g., "Medical Condition") resulted in a Neo.ClientError.Statement.SyntaxError when generating Cypher queries. The issue was caused by node names with spaces not being wrapped in quotes, which are required for correct Cypher syntax.

Modified the extract_cypher function to wrap node names containing spaces in backticks.

Issue:

Fixes #28375

Dependencies:

N/A

Test Coverage:

Unit tests have been added to ensure that node names with single and multiple spaces are correctly wrapped in backticks.
Queries with already backtick-wrapped node names remain unaffected.

Lint and Test:

Ran make format, make lint, and make test to ensure all tests pass and the code adheres to the formatting standards.

chkaty and others added 2 commits December 17, 2024 23:11
- Updated `extract_cypher` to wrap node label with spaces in quotes.
- Added tests for node names with one and multiple spaces.
- Renamed test cases to improve clarity.
- Checked lint and format.
@alexthomas93
Copy link
Collaborator

@CodiumAI-Agent /update_changelog

@CodiumAI-Agent
Copy link

Changelog updates: 🔄

Next *

Fixed

  • Resolved syntax errors in GraphCypherQAChain by ensuring node labels with spaces are correctly quoted in Cypher queries.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@alexthomas93 alexthomas93 self-requested a review January 8, 2025 13:11
Copy link
Collaborator

@alexthomas93 alexthomas93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your contribution!

@alexthomas93 alexthomas93 merged commit ceaf64a into langchain-ai:main Jan 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants